<%@page import="siteflash.controller.General"%>
<%@page import="siteflash.helper.StringHelper"%>
<%@page import="siteflash.model.Paginate"%>
<%@page import="siteflash.model.Tag"%>
<%@page import="java.util.ArrayList"%>
<%@page import="siteflash.model.Game" %>

<%
    String title = (String) request.getAttribute("title");
    String description = (String) request.getAttribute("description");
    String keywords = (String) request.getAttribute("keyword");
    String keysearch = request.getAttribute("keySearch") != null ? (String) request.getAttribute("keySearch") : "";
    
    ArrayList<Game> games = (ArrayList<Game>) request.getAttribute("games");
    ArrayList<Game> hotGames = (ArrayList<Game>) request.getAttribute("hotGame");
    ArrayList<Tag> tags = (ArrayList<Tag>) request.getAttribute("tags");
    Paginate paginate = (Paginate) request.getAttribute("paginate");
    String pageName = (String) request.getAttribute("pageName");
    
%>
<jsp:include page="/layouts/header.jsp">
    <jsp:param name="title" value="<%=title %>" />
    <jsp:param name="description" value="<%=description %>" />
    <jsp:param name="keywords" value="<%=keywords %>" />
    <jsp:param name="page" value="home" />
    <jsp:param name="ogtitle" value="Y1s Game Directory" />
    <jsp:param name="ogimage" value="http://www.y1s.org/images/logo.png" />
    <jsp:param name="ogescription" value="Home Page Y1s" />
</jsp:include>

<script type="text/javascript">
$(function(){
    // Set starting slide to 1
    var startSlide = 1;
    // Get slide number if it exists
    if (window.location.hash) {
        startSlide = window.location.hash.replace('#','');
    }
    // Initialize Slides
    $('#slides').slides({
        preload: true,
        preloadImage: '/images/loading.gif',
        generatePagination: false,
        play: 5000,
        pause: 2500,
        hoverPause: true,
        // Get the starting slide
        start: startSlide,
        animationComplete: function(current){
            // Set the slide number as a hash
            //window.location.hash = '#' + current;
        }
    });
});
</script>
       <div class="wrap">
            <div id="slides">
                <div class="slides_container">
                    <div class="slide">
                        <img alt="" src="/images/slide.jpg" />
                    </div>
                    <div class="slide">
                        <img alt="" src="/images/1.jpg" />
                    </div>
                    <div class="slide">
                        <img alt="" src="/images/2.jpg" />
                    </div>
                    <div class="slide">
                        <img alt="" src="/images/4.jpg" />
                    </div>
                    <div class="slide">
                        <img alt="" src="/images/7.jpg" />
                    </div>
                </div>
                <a href="#" class="prev"><img src="/images/arrow-prev.png" width="24" height="43" alt="Arrow Prev" /></a>
                <a href="#" class="next"><img src="/images/arrow-next.png" width="24" height="43" alt="Arrow Next" /></a>
            </div>
        </div>
        <div class="main-content">
          <div class="left-main">
              <div class="newgame">
                  <img src="/images/button_newgame.png" alt="" />
              </div>
              <div class="categories">
                  <div class="top"></div>
                  <div class="main">
                      <div class="title">Categories</div>
                      <ul>
                          <% for (int i = 0; i < tags.size(); i++) {
                        	   if (i < 58) {
                          %>
                          <li><a href="/tags/<%=tags.get(i).getAlias()%>"><%=tags.get(i).getName() %></a> (<%=tags.get(i).getTotal()%>)</li>
                          <%   } 
                          } %>
                      </ul>
                  </div>
                  <%if (tags.size() >= 58) { %>
                  <div class="more_lnk"><a href="/tag-list">Show all</a></div>
                  <% } %>
                  <div class="bottom"></div>
              </div>
              <div class="share">
                <!-- AddThis Button BEGIN -->
				<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
				<a class="addthis_button_facebook"></a>
				<a class="addthis_button_twitter"></a>
				<a class="addthis_button_google_plusone"></a>
				</div>
				<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f4f217074402877"></script>
				<!-- AddThis Button END -->
				
              </div>
          </div>
          <div class="right-main">
              <div class="search">
                <form action="/search" method="get" name="form-search" class="form-search">
                  <div class="left">
                      <input type="text" name="keysearch" class="searchtext" value="<%=keysearch%>"/>
                  </div>
                  <div class="left">
                      <input type="submit"  src="/images/search.png" class="searchbtn" value=""/>
                  </div>
                  <div class="clear"></div>
                </form>
              </div>
              <div class="hotgame">
                  <div class="title">Hot game</div>
                  <div class="games">
                    <% for (int i = 0; i < hotGames.size(); i++) { %>
                    <div class="game">
                        <div class="image"><a href="/game/<%=hotGames.get(i).getAlias()%>"><img src="<%=hotGames.get(i).getImageThumb().getValue() %>" width="78" height="78" /></a></div>
                        <div class="name"><a href="/game/<%=hotGames.get(i).getAlias()%>"><%=StringHelper.cutString(hotGames.get(i).getName(), 3) %></a></div>
                    </div>
                    <% } %>
                      <div class="clear"></div>
                  </div>
              </div>
              <div class="maincontent">
                  <jsp:include page="/pages/paginate.jsp">
                    <jsp:param name="paginate" value="<%=paginate %>" />
                    <jsp:param name="pageName" value="<%=pageName %>" />
                  </jsp:include>
                  <div class="games">
                      <% for (int i = 0; i < games.size(); i++) { %>
                      <div class="game">
                          <div class="image"><a href="/game/<%=games.get(i).getAlias()%>"><img src="<%=games.get(i).getImageThumb().getValue() %>" /></a></div>
                          <div class="name"><a href="/game/<%=games.get(i).getAlias()%>"><%=games.get(i).getName() %></a></div>
                      </div>
                      <% } %>
                  </div>
                  <jsp:include page="/pages/paginate.jsp">
				    <jsp:param name="paginate" value="<%=paginate %>" />
				    <jsp:param name="pageName" value="<%=pageName %>" />
				  </jsp:include>
              </div>
          </div>
          <div class="clear"></div>
        </div>
<jsp:include page="/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>